import api from "./index";

// export const GET_BANNERLIST = () => {
//   return api({ url: '/index/index' })
// }
// 登录
export const DOLOGIN = (data) => {
  return api({ method: "post", url: "login", data });
};
// 获取商品列表
export const GET_GOODSLIST = (params) => {
  return api({ url: "goods", params });
};
// 删除某个商品
export const DELETE_GOODS = (id) => {
  return api({ method: "delete", url: `goods/${id}` });
};
// 获取商品分类
export const GET_GOODSCATE = () => {
  return api({ url: "categories" });
};
// 获取商品版式
export const GET_GRAPHYLIST = (type) => {
  return api({ url: `categories/6/attributes?sel=${type}` });
};
// 添加商品
export const ADD_GOODS = (data) => {
  return api({ method: "post", url: "goods", data });
};
// 商品详情
export const GETGOODSDETAIL = (id) => {
  return api({ url: `goods/${id}` });
};
// 用户来源echarts
export const GET_USERSOURCE = () => {
  return api({ url: "reports/type/1" });
};
// 获取商品版式信息
export const GET_GRAPHYMESSAGE = (id) => {
  return api({ url: `categories/${id}/attributes?sel=many` });
};
// 添加新的版型
export const ADD_GRAPHYMESSAGE = (id, data) => {
  return api({
    method: "post",
    url: `categories/${id}/attributes?sel=many`,
    data,
  });
};
// 更新版型
export const HANDLE_GRAPHYMESSAGE = (id, gid, data) => {
  return api({
    method: "put",
    url: `categories/${id}/attributes/${gid}`,
    data,
  });
};
// 更新版型
export const DELETE_GRAPHYMESSAGE = (id, gid) => {
  return api({ method: "delete", url: `categories/${id}/attributes/${gid}` });
};
// 获取商品分类
export const GET_GOODSDATEAPI = (data) => {
  return api({ url: `categories`, data });
};
// 添加新的分类
export const ADD_NEWDOCATE = (data) => {
  return api({ method: "post", url: `categories`, data });
};
// 修改分类
export const REVISE_NEWDOCATE = (id, data) => {
  return api({ method: "put", url: `categories/${id}`, data });
};
// 删除分类
export const DELETE_NEWDOCATE = (id) => {
  return api({ method: "delete", url: `categories/${id}` });
};
// 获取角色列表

export const V3_GetRolesListApi = (id) => {
  return api({ url: `roles` });
};
// 编辑角色
export const V3_UpdateRolesApi = (id, data) => {
  return api({ method: "put", url: `roles/${id}`, data });
};
// 新增角色
export const V3_AddRolesApi = (data) => {
  return api({ method: "post", url: `roles`, data });
};
// 删除角色
export const V3_DeleteRolesApi = (id) => {
  return api({ method: "delete", url: `roles/${id}` });
};
// 删除权限  roles/30/rights/109
export const V3_DeleteRightsApi = (rid, id) => {
  return api({ method: "delete", url: `roles/${rid}/rights/${id}` });
};
// 获取权限树形结构 /rights/tree
export const V3_GetRightsApi = () => {
  return api({ method: "get", url: `rights/tree` });
};
// 修改权限
export const V3_UpdateRightsApi = (id, data) => {
  return api({ method: "post", url: `roles/${id}/rights`, data });
};
// 获取权限列表 rights/list

export const V3_GetRightsListApi = () => {
  return api({ method: "get", url: `rights/list` });
};
